There are other factors that have more influence on life expectancy that should be prioritized.

There are other factors that have more influence on life expectancy that should be prioritized.#

The First Argument of Your Second Perspective#

Even though A country investing in their education program results in an increase in life expectancy. There are more direct approaches to increasing a country’s life expectancy. One possible solution is investing in increasing the country’s vaccination rate. Diseases or viruses like Polio and Diphtheria can be fatal if not treated appropriately, in some cases (like for polio) there is no cure at all. Not treating these diseases results in a drastic decrease in life expectancy. So instead of investing in education to improve life expectancy, a country should invest in vaccines as this has a more direct effect. This can be seen in the plot where it shows an increase in vaccination rate for polio and Diphtheria corresponds with an increase in life expectancy. This is also found in the research by Jenifer Ehreth. Which concludes that improving the vaccination rate is a big factor in increasing a country’s life expectancy. https://www.sciencedirect.com/science/article/pii/S0264410X03003773

Hide code cell source
import pandas as pd
import matplotlib.pyplot as plt

# Load the data
df_life = pd.read_csv('life_expectancy.csv')

# Create a figure and axes for the subplots
fig, (ax1, ax2) = plt.subplots(2, 1, figsize=(10, 10))

# Sort the DataFrame by 'Polio' column and plot
df_life_sorted_polio = df_life.sort_values(by='Polio')
ax1.bar(df_life_sorted_polio['Polio'], df_life_sorted_polio['Life expectancy'])
ax1.set_xlabel('Polio Vaccination Rate')
ax1.set_ylabel('Life Expectancy')
ax1.set_title('Polio Vaccination Rate vs Life Expectancy')

# Sort the DataFrame by 'Diphtheria' column and plot
df_life_sorted_diphtheria = df_life.sort_values(by = 'Diphtheria')
ax2.bar(df_life_sorted_diphtheria['Diphtheria'], df_life_sorted_diphtheria['Life expectancy'])
ax2.set_xlabel('Diphtheria Vaccination Rate')
ax2.set_ylabel('Life Expectancy')
ax2.set_title('Diphtheria Vaccination Rate vs Life Expectancy')

# Adjust layout to prevent overlap
plt.tight_layout()

# Show the plot
plt.show()
../_images/70839695ba0eef3fe516aa4f39a5836a02a12c32d8317a6c706835f655dbc455.png
Hide code cell source
import plotly.express as px
import pandas as pd

# Read the CSVs
df = pd.read_csv('all_vaccine_data.csv')
df = df.drop(columns=['DOSES', 'TARGET_NUMBER'])
df = df.dropna()

# Create the scatter plot with Plotly Express
years_sorted = sorted(df['YEAR'].unique())

fig = px.scatter(df, 
                 x='COVERAGE', 
                 y='Life Expectancy', 
                 animation_frame='YEAR', 
                 animation_group='Country Name',
                 size='Child Mortality per 1000 ', 
                 color='continent', 
                 hover_name='Country Name',
                 size_max=55, 
                 range_x=[0, 100], 
                 range_y=[0, 100],
                 height=350,
                 width=500,
                 category_orders={'YEAR': years_sorted})

# Update the layout with x-axis titles and other configurations
fig.update_layout(
    title="Life Expectancy vs Vaccination Rates",
    plot_bgcolor='#fdead4',
    paper_bgcolor='#fdead4',
    margin=dict(l=20, r=20, t=50, b=50),
    xaxis=dict(title='Vaccination Rate (%)'),   
    yaxis=dict(title='Life Expectancy'),
    showlegend=True,
)

# Show the plot
fig.show()